#include "system_task.h"
#include "cmsis_os.h"

system_t system;
extern mpu6050_t mpu6050;

void system_task(void const *pvParameters)
{

    while (1)
    {
        system.GetInfo();
        system.SendData();
        
        osDelay(2);
    }
    
}


void system_t::GetInfo()
{
    system.pitch_angle = mpu6050.pitch;
    system.roll_angle = mpu6050.roll;
    system.accel_pitch = mpu6050.accel_pitch;
    system.accel_roll = mpu6050.accel_roll;
}

void system_t::SendData()
{
    CAN_send_mpu6050_measure(system.accel_pitch,system.accel_roll,system.pitch_angle,system.roll_angle);


}
